<?php

declare(strict_types=1);

use Hyperf\DbConnection\Db;
use Hyperf\Database\Seeders\Seeder;

class PermissionSeeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        if (!Db::table('permission')->where('path', '/admin/v1/admin/page')->exists()) {
            Db::table('permission')->insert([
                [
                    'name' => '分页',
                    'menu_id' => 3,
                    'path' => '/admin/v1/admin/page',
                    'method' => 'GET',
                    'link' => '',
                    'version' => 'v1',
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'name' => '新增',
                    'menu_id' => 3,
                    'path' => '/admin/v1/admin',
                    'method' => 'POST',
                    'link' => '',
                    'version' => 'v1',
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'name' => '编辑',
                    'menu_id' => 3,
                    'path' => '/admin/v1/admin/{id}',
                    'method' => 'PUT',
                    'link' => '',
                    'version' => 'v1',
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'name' => '删除',
                    'menu_id' => 3,
                    'path' => '/admin/v1/admin',
                    'method' => 'DELETE',
                    'link' => '',
                    'version' => 'v1',
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'name' => '分页',
                    'menu_id' => 4,
                    'path' => '/admin/v1/admin/role/page',
                    'method' => 'GET',
                    'link' => '',
                    'version' => 'v1',
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'name' => '新增',
                    'menu_id' => 4,
                    'path' => '/admin/v1/admin/role',
                    'method' => 'POST',
                    'link' => '',
                    'version' => 'v1',
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'name' => '编辑',
                    'menu_id' => 4,
                    'path' => '/admin/v1/admin/role/{id}',
                    'method' => 'PUT',
                    'link' => '',
                    'version' => 'v1',
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'name' => '删除',
                    'menu_id' => 4,
                    'path' => '/admin/v1/admin/role',
                    'method' => 'DELETE',
                    'link' => '',
                    'version' => 'v1',
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'name' => '列表',
                    'menu_id' => 5,
                    'path' => '/admin/v1/admin/menu/index',
                    'method' => 'GET',
                    'link' => '',
                    'version' => 'v1',
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'name' => '新增',
                    'menu_id' => 5,
                    'path' => '/admin/v1/admin/menu',
                    'method' => 'POST',
                    'link' => '',
                    'version' => 'v1',
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'name' => '编辑',
                    'menu_id' => 5,
                    'path' => '/admin/v1/admin/menu/{id}',
                    'method' => 'PUT',
                    'link' => '',
                    'version' => 'v1',
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'name' => '删除',
                    'menu_id' => 5,
                    'path' => '/admin/v1/admin/menu',
                    'method' => 'DELETE',
                    'link' => '',
                    'version' => 'v1',
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'name' => '排序',
                    'menu_id' => 5,
                    'path' => '/admin/v1/admin/menu/sort/{id}',
                    'method' => 'PUT',
                    'link' => '',
                    'version' => 'v1',
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'name' => '分页',
                    'menu_id' => 6,
                    'path' => '/admin/v1/admin/log/page',
                    'method' => 'GET',
                    'link' => '',
                    'version' => 'v1',
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ]
            ]);
        }
    }
}
